package com.xbongbong.saas.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * Description:
 *
 * @Author: pkh
 * @Date: 03-22
 */
@AllArgsConstructor
@Getter
public enum ContractCompareThirdPartyErrorEnum {

    PARAMETER_ERROR(101, "参数格式不正确"),
    DATA_ISNULL(206, "数据为空"),
    TASK_OPERATION_FAILURE(243,"任务操作失败"),
    TASK_CREATE_FAILURE(262,"任务操作失败"),
    APP_KEY_AND_APP_SECRET_NOT_MATCH(263,"app-key 和 app-secret 与配置⻚中的不匹配"),
    APP_NOT_EXIST(40101,"应⽤不存在"),
    INVALID_APP_SECRET(40102," 应⽤验证失败"),
    INVALID_APP(40103,"应⽤已失效"),
    APP_HAS_EXPIRED(40104,"应⽤已超过有效期"),
    INVALID_IP_SOURCE(40105,"⽆效的IP来源"),
    APP_NOT_MATCH_SERVICE(40106,"应⽤与service不匹配"),
    APP_HAS_BEEN_OVERDRAWN(40107,"应⽤额度已⽤完，请充值后使⽤"),
    QPS_LIMIT_REACHED(40109, "达到 qps 限制，请求拒绝"),
    SERVICE_NOT_SUPPORT(40202,"请求了不⽀持的服务"),
    API_IS_NOT_CONFIGURED_CORRECTLY(40203,"API配置不正确"),
    FAILURE_TO_DEDUCT_FEES(5000, "扣费失败"),
    MISSING_PARAMETER(5001, "缺失参数"),
    SERVICE_INTERNAL_ERROR(500, "服务内部错误"),
    ;



    private Integer code;

    private String memo;

    public static ContractCompareThirdPartyErrorEnum getByCode(Integer code) {
        for (ContractCompareThirdPartyErrorEnum item : values()) {
            if (Objects.equals(item.getCode(), code)) {
                return item;
            }
        }
        return null;
    }
}
